package com.demo.websocket;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.websocket.ContainerProvider;
import javax.websocket.WebSocketContainer;
import java.net.URI;

/**
 * 项目初始化完成后立即执行
 * @author ZM
 */
@Component
@Slf4j
public class CommandLineRunnerImpl implements CommandLineRunner {
    @Autowired
    MyClientSocket myClientSocket;
    @Autowired
    WebSocketServer webSocketServer;

    @Override
    public void run(String... args) throws Exception {
        log.info("初始化完成......，开始创建WebSocket客户端.......");
        WebSocketContainer container = ContainerProvider.getWebSocketContainer();
//        container.connectToServer(myClientSocket, new URI("ws://127.0.0.1:9005/websocket/his"));
    }


}
